package com.chitang.sync;

import com.chitang.common.IMysqlSyncPlugin;
import com.chitang.common.dto.CanalMessage;
import com.chitang.domain.TrolleyInfo;
import com.chitang.service.TrolleyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: wjs
 * @CreateTime: 2023-02-20 12:50
 */
@Component
public class TrolleyInfoSyncPlugin implements IMysqlSyncPlugin<TrolleyInfo> {

    @Autowired
    private TrolleyInfoService trolleyInfoService;

    @Override
    public String tableName() {
        return "b_trolley_info";
    }

    @Override
    public void insertEvent(CanalMessage message, List<TrolleyInfo> dataList) {
        trolleyInfoService.sync2Es(dataList);
    }

    @Override
    public void updateEvent(CanalMessage message, List<TrolleyInfo> dataList) {
        trolleyInfoService.sync2Es(dataList);
    }

    @Override
    public void deleteEvent(CanalMessage message, List<TrolleyInfo> dataList) {
        trolleyInfoService.sync2Es(dataList);
    }
}
